<?php

namespace app\api\validate;

use think\Validate;

class House extends Validate
{

    /**
     * 验证规则
     */
    protected $rule = [
        'house_title' => 'require',
        'address' => 'require',
        'province' => 'require',
        'city' => 'require',
        'house_number' => 'require',
        'area'    => 'require',
        'community'    => 'require',
        'house_type_id'=>'require',

        'house_property_cert_img'=>'require',
        //'purchase_contract_time'=>'require',
        //'purchase_contract_img'=>'require',
        //'evaluation_report_img'=>'require',
        //'renovation_contract_img'=>'require',
        //'renovation_contract_time'=>'require',
        //'insurance_contract_img'=>'require',
        //'insurance_contract_time'=>'require',
        /*'unit_price'=>'require',
        'total_area'=>'require',
        'total_price'=>'require',
        'decorate_price'=>'require',
        'average_price'=>'require',*/

        //'bed_info'=>'require',
        'house_facilities_id'=>'require',
        'live_time'=>'require',
        'leave_time'=>'require',

        'sheet_change'=>'require',
        'clean'=>'require',
        'share_weekday_price'=>'require',
        'share_weekend_price'=>'require',
        'share_highday_price'=>'require',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'house_title' => '请输入房屋标题',
        'address' => '请选择详细地址',
        'province' => '请选择所在省份',
        'city' => '请选择所在市',
        'house_number' => '请输入门牌号',
        'area' => '请输入建筑面积',
        'community'=>'请输入所属社区',
        'house_type_id'=>'请选择房屋类型',

        'house_property_cert_img'=>'请上传房产证图片',
        //'purchase_contract_time'=>'请选择购房合同有效期',
        //'purchase_contract_img'=>'请上传购房合同图片',
        //'evaluation_report_img'=>'请上传评估报告图片',
        //'renovation_contract_img'=>'请上传装修合同图片',
        //'renovation_contract_time'=>'请选择装修合同有效期',
        //'insurance_contract_img'=>'请上传房屋保险合同图片',
        //'insurance_contract_time'=>'请选择保险合同有效期',
        //'unit_price'=>'请输入单价',
        //'total_area'=>'请输入总面积',
        //'total_price'=>'请输入总价',
        //'decorate_price'=>'请输入装修费用',
        //'average_price'=>'请输入社区房屋均价',

        //'bed_info'=>'请添加床铺信息',
        'house_facilities_id'=>'请选择房屋设施',
        'live_time'=>'请选择入驻时间',
        'leave_time'=>'请选择退房时间',

        'sheet_change'=>'请输入被单更换',
        'clean'=>'请输入卫生打扫',
        'share_weekday_price'=>'请输入房屋共享的平日价格',
        'share_weekend_price'=>'请输入房屋共享的周末价格',
        'share_highday_price'=>'请输入房屋共享的节假日价格',
    ];

    /**
     * 字段描述
     */
    protected $field = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['house_title', 'address', 'province', 'city', 'house_number','area','community','house_type_id','bed_info',
            'house_facilities_id','live_time','leave_time','house_property_cert_img',
            'sheet_change','clean','share_weekday_price',
            'share_weekend_price','share_highday_price'],
        'edit' => ['house_title', 'address', 'province', 'city', 'house_number','area','community','house_type_id','bed_info',
            'house_facilities_id','live_time','leave_time','house_property_cert_img',
            'sheet_change','clean','share_weekday_price',
            'share_weekend_price','share_highday_price'],
    ];

    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'house_title' => __('房屋标题'),
            'address' => __('详细地址'),
            'province' => __('省'),
            'city'    => __('市'),
            'house_number'   => __('门牌号'),
            'area'   => __('建筑面积'),
            'community'   => __('所属社区'),
            'house_type_id'   => __('房屋类型'),
            //'bed_info'   => __('床铺信息'),
            'house_facilities_id'   => __('房屋设施'),
            'live_time'   => __('入驻时间'),
            'leave_time'   => __('退房时间'),

            'house_property_cert_img'   => __('房产证图片'),
            //'purchase_contract_time'   => __('购房合同有效期'),
            //'purchase_contract_img'   => __('购房合同图片'),
            //'evaluation_report_img'   => __('评估报告图片'),
            //'renovation_contract_img'   => __('装修合同图片'),
            //'renovation_contract_time'   => __('装修合同有效期'),
            //'insurance_contract_img'   => __('房屋保险合同图片'),
            //'insurance_contract_time'   => __('保险合同有效期'),
           /* 'unit_price'   => __('单价'),
            'total_area'   => __('总面积'),
            'total_price'   => __('总价'),
            'decorate_price'   => __('装修费用'),
            'average_price'   => __('社区房屋均价'),*/
            'sheet_change'   => __('被单更换'),
            'clean'   => __('卫生打扫'),
            'share_weekday_price'   => __('房屋共享的平日价格'),
            'share_weekend_price'   => __('房屋共享的周末价格'),
            'share_highday_price'   => __('房屋共享的节假日价格'),
        ];

        parent::__construct($rules, $message, $field);
    }

}
